﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Ataric.SuppressWP.Model;

namespace Ataric.SuppressWP.Model
{
    [Serializable]
    [XmlRoot("SuppressSettings")]
    public class SuppressSettings : List<SuppressGroup>
    {
         public SuppressItem this[string name]
         {
             get{
                 foreach (var group in this)
                 {
                     var item = group.SuppressItems.Where(p => p.Name == name).FirstOrDefault();
                     if (item != null) return item;
                 }
                 return null;
             }
         }
    
    }
 
    public class SuppressGroup
    {
         [XmlAttribute]
        public  string Name { get; set; }
         [XmlAttribute]
        public string Description { get; set; }
        public SuppressItemCollection SuppressItems { get; set; }
        public string CSSExtra { get; set; }
    }
}
